package com.mondo.financialwallet.presentation.ui.widget;

import android.graphics.Rect;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.mondo.financialwallet.R;

public class FinalSpacingItemDecoration extends RecyclerView.ItemDecoration {

    @Override
    public void getItemOffsets(
            @NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent,
            @NonNull RecyclerView.State state) {

        LinearLayoutManager lm = (LinearLayoutManager) parent.getLayoutManager();

        if (parent.getChildAdapterPosition(view) == lm.getItemCount() - 1) {
            outRect.bottom = parent.getContext().getResources()
                    .getDimensionPixelOffset(R.dimen.default_view_space);
        }

        //super.getItemOffsets(outRect, view, parent, state);
    }
}
